Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
make-event-props
Advanced tools
Returns an object with on-event callback props curried with provided args.
The make-event-props npm package is designed to help developers create event properties for React components. It simplifies the process of binding event handlers to components by generating the necessary props for a given set of event names.
Generate Event Props
This feature allows you to generate event properties for a set of event names. You provide the event names and corresponding handlers, and the package returns an object with the event properties.
const makeEventProps = require('make-event-props');
const eventNames = ['onClick', 'onMouseEnter'];
const eventHandlers = {
onClick: () => console.log('Clicked!'),
onMouseEnter: () => console.log('Mouse Entered!')
};
const props = makeEventProps(eventNames, eventHandlers);
console.log(props); // { onClick: [Function], onMouseEnter: [Function] }
Filter Event Handlers
This feature allows you to filter and include only the event handlers that match the provided event names. It helps in managing and organizing event handlers efficiently.
const makeEventProps = require('make-event-props');
const eventNames = ['onClick', 'onMouseEnter', 'onMouseLeave'];
const eventHandlers = {
onClick: () => console.log('Clicked!'),
onMouseEnter: () => console.log('Mouse Entered!'),
onMouseLeave: () => console.log('Mouse Left!')
};
const props = makeEventProps(eventNames, eventHandlers);
console.log(props); // { onClick: [Function], onMouseEnter: [Function], onMouseLeave: [Function] }
The react-event-listener package provides a way to manage global event listeners in a React application. Unlike make-event-props, which focuses on generating event props for components, react-event-listener is more about attaching and managing global event listeners.
A function that, given props, returns an object of event callback props optionally curried with additional arguments.
This package allows you to pass event callback props to a rendered DOM element without the risk of applying any invalid props that could cause unwanted side effects.
npm install make-event-props
or yarn add make-event-props
.import makeEventProps from 'make-event-props'
.const eventProps = useMemo(
() => makeEventProps(props, (eventName) => additionalArgs),
[additionalArgs],
);
return <div {...eventProps} />;
The MIT License.
Wojciech Maj |
FAQs
Returns an object with on-event callback props curried with provided args.
We found that make-event-props demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.